function Product(params){ 
	 
}

Product.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new Product.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new Product.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new Product.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.id=function(id){if(this.proxy)return this.getProxy().id(id);  this.put("id", id);return this;};
	/** and id is null */
	this.idNull=function(){if(this.proxy)return this.getProxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
	/** not .... */
	this.idNot=function(){if(this.proxy)return this.getProxy().idNot();this.put("idNot", "not");return this;};
	this.idNotNull=function(){if(this.proxy)return this.getProxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
	this.idNot=function(id){if(this.proxy)return this.getProxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
		
	/** and id <= ? */
	this.idMin=function(min){if(this.proxy)return this.getProxy().idMin(min);this.put("idMin", min);return this;};
	/** and id >= ? */
	this.idMax=function(max){if(this.proxy)return this.getProxy().idMax(max);this.put("idMax", max);return this;};
		
		
	this.idIn=function(ids){
		if(this.proxy)return this.getProxy().idIn(ids);  this.put("idIn", ids);return this;
	};	
		 
	
	
	/** 商品名 [非空]       **/
	this.name=function(name){if(this.proxy)return this.getProxy().name(name);  this.put("name", name);return this;};
	/** and name is null */
	this.nameNull=function(){if(this.proxy)return this.getProxy().nameNull();if(this.get("nameNot")==null)this.put("nameNot", "");this.put("name", null);return this;};
	/** not .... */
	this.nameNot=function(){if(this.proxy)return this.getProxy().nameNot();this.put("nameNot", "not");return this;};
	this.nameNotNull=function(){if(this.proxy)return this.getProxy().nameNotNull();this.put("nameNot", "not");this.put("name", null);return this;};
	this.nameNot=function(name){if(this.proxy)return this.getProxy().nameNot(name);this.put("nameNot", "not");this.put("name", name);return this;};
		
		 
	
	
	/** 品牌信息  [Merchant]      **/
	this.merchant=function(merchant){if(this.proxy)return this.getProxy().merchant(merchant);  this.put("merchant", merchant);return this;};
	/** and merchant is null */
	this.merchantNull=function(){if(this.proxy)return this.getProxy().merchantNull();if(this.get("merchantNot")==null)this.put("merchantNot", "");this.put("merchant", null);return this;};
	/** not .... */
	this.merchantNot=function(){if(this.proxy)return this.getProxy().merchantNot();this.put("merchantNot", "not");return this;};
	this.merchantNotNull=function(){if(this.proxy)return this.getProxy().merchantNotNull();this.put("merchantNot", "not");this.put("merchant", null);return this;};
	this.merchantNot=function(merchant){if(this.proxy)return this.getProxy().merchantNot(merchant);this.put("merchantNot", "not");this.put("merchant", merchant);return this;};
		
		
	this.merchantIn=function(ids){
		if(this.proxy)return this.getProxy().merchantIn(ids);  this.put("merchantIn", ids);return this;
	};	
		 
	
	
	/** 用户编号 [非空]       **/
	this.uid=function(uid){if(this.proxy)return this.getProxy().uid(uid);  this.put("uid", uid);return this;};
	/** and uid is null */
	this.uidNull=function(){if(this.proxy)return this.getProxy().uidNull();if(this.get("uidNot")==null)this.put("uidNot", "");this.put("uid", null);return this;};
	/** not .... */
	this.uidNot=function(){if(this.proxy)return this.getProxy().uidNot();this.put("uidNot", "not");return this;};
	this.uidNotNull=function(){if(this.proxy)return this.getProxy().uidNotNull();this.put("uidNot", "not");this.put("uid", null);return this;};
	this.uidNot=function(uid){if(this.proxy)return this.getProxy().uidNot(uid);this.put("uidNot", "not");this.put("uid", uid);return this;};
		
		 
	
	
	/** 会员名称        **/
	this.nickName=function(nickName){if(this.proxy)return this.getProxy().nickName(nickName);  this.put("nickName", nickName);return this;};
	/** and nick_name is null */
	this.nickNameNull=function(){if(this.proxy)return this.getProxy().nickNameNull();if(this.get("nickNameNot")==null)this.put("nickNameNot", "");this.put("nickName", null);return this;};
	/** not .... */
	this.nickNameNot=function(){if(this.proxy)return this.getProxy().nickNameNot();this.put("nickNameNot", "not");return this;};
	this.nickNameNotNull=function(){if(this.proxy)return this.getProxy().nickNameNotNull();this.put("nickNameNot", "not");this.put("nickName", null);return this;};
	this.nickNameNot=function(nickName){if(this.proxy)return this.getProxy().nickNameNot(nickName);this.put("nickNameNot", "not");this.put("nickName", nickName);return this;};
		
		 
	
	
	/** 所属会员  [Member]      **/
	this.member=function(member){if(this.proxy)return this.getProxy().member(member);  this.put("member", member);return this;};
	/** and member is null */
	this.memberNull=function(){if(this.proxy)return this.getProxy().memberNull();if(this.get("memberNot")==null)this.put("memberNot", "");this.put("member", null);return this;};
	/** not .... */
	this.memberNot=function(){if(this.proxy)return this.getProxy().memberNot();this.put("memberNot", "not");return this;};
	this.memberNotNull=function(){if(this.proxy)return this.getProxy().memberNotNull();this.put("memberNot", "not");this.put("member", null);return this;};
	this.memberNot=function(member){if(this.proxy)return this.getProxy().memberNot(member);this.put("memberNot", "not");this.put("member", member);return this;};
		
		
	this.memberIn=function(ids){
		if(this.proxy)return this.getProxy().memberIn(ids);  this.put("memberIn", ids);return this;
	};	
		 
	
	
	/** 商品信息  [Commodity]      **/
	this.commodity=function(commodity){if(this.proxy)return this.getProxy().commodity(commodity);  this.put("commodity", commodity);return this;};
	/** and commodity is null */
	this.commodityNull=function(){if(this.proxy)return this.getProxy().commodityNull();if(this.get("commodityNot")==null)this.put("commodityNot", "");this.put("commodity", null);return this;};
	/** not .... */
	this.commodityNot=function(){if(this.proxy)return this.getProxy().commodityNot();this.put("commodityNot", "not");return this;};
	this.commodityNotNull=function(){if(this.proxy)return this.getProxy().commodityNotNull();this.put("commodityNot", "not");this.put("commodity", null);return this;};
	this.commodityNot=function(commodity){if(this.proxy)return this.getProxy().commodityNot(commodity);this.put("commodityNot", "not");this.put("commodity", commodity);return this;};
		
	/** and commodity <= ? */
	this.commodityMin=function(min){if(this.proxy)return this.getProxy().commodityMin(min);this.put("commodityMin", min);return this;};
	/** and commodity >= ? */
	this.commodityMax=function(max){if(this.proxy)return this.getProxy().commodityMax(max);this.put("commodityMax", max);return this;};
		
		
	this.commodityIn=function(ids){
		if(this.proxy)return this.getProxy().commodityIn(ids);  this.put("commodityIn", ids);return this;
	};	
		 
	
	
	/** 价格        **/
	this.pPrice=function(pPrice){if(this.proxy)return this.getProxy().pPrice(pPrice);  this.put("pPrice", pPrice);return this;};
	/** and p_price is null */
	this.pPriceNull=function(){if(this.proxy)return this.getProxy().pPriceNull();if(this.get("pPriceNot")==null)this.put("pPriceNot", "");this.put("pPrice", null);return this;};
	/** not .... */
	this.pPriceNot=function(){if(this.proxy)return this.getProxy().pPriceNot();this.put("pPriceNot", "not");return this;};
	this.pPriceNotNull=function(){if(this.proxy)return this.getProxy().pPriceNotNull();this.put("pPriceNot", "not");this.put("pPrice", null);return this;};
	this.pPriceNot=function(pPrice){if(this.proxy)return this.getProxy().pPriceNot(pPrice);this.put("pPriceNot", "not");this.put("pPrice", pPrice);return this;};
		
	/** and p_price <= ? */
	this.pPriceMin=function(min){if(this.proxy)return this.getProxy().pPriceMin(min);this.put("pPriceMin", min);return this;};
	/** and p_price >= ? */
	this.pPriceMax=function(max){if(this.proxy)return this.getProxy().pPriceMax(max);this.put("pPriceMax", max);return this;};
		
		 
	
	
	/** 单位        **/
	this.pUnit=function(pUnit){if(this.proxy)return this.getProxy().pUnit(pUnit);  this.put("pUnit", pUnit);return this;};
	/** and p_unit is null */
	this.pUnitNull=function(){if(this.proxy)return this.getProxy().pUnitNull();if(this.get("pUnitNot")==null)this.put("pUnitNot", "");this.put("pUnit", null);return this;};
	/** not .... */
	this.pUnitNot=function(){if(this.proxy)return this.getProxy().pUnitNot();this.put("pUnitNot", "not");return this;};
	this.pUnitNotNull=function(){if(this.proxy)return this.getProxy().pUnitNotNull();this.put("pUnitNot", "not");this.put("pUnit", null);return this;};
	this.pUnitNot=function(pUnit){if(this.proxy)return this.getProxy().pUnitNot(pUnit);this.put("pUnitNot", "not");this.put("pUnit", pUnit);return this;};
		
		 
	
	
	/** 商品图        **/
	this.img=function(img){if(this.proxy)return this.getProxy().img(img);  this.put("img", img);return this;};
	/** and img is null */
	this.imgNull=function(){if(this.proxy)return this.getProxy().imgNull();if(this.get("imgNot")==null)this.put("imgNot", "");this.put("img", null);return this;};
	/** not .... */
	this.imgNot=function(){if(this.proxy)return this.getProxy().imgNot();this.put("imgNot", "not");return this;};
	this.imgNotNull=function(){if(this.proxy)return this.getProxy().imgNotNull();this.put("imgNot", "not");this.put("img", null);return this;};
	this.imgNot=function(img){if(this.proxy)return this.getProxy().imgNot(img);this.put("imgNot", "not");this.put("img", img);return this;};
		
		 
	
	
	/** 数量        **/
	this.number=function(number){if(this.proxy)return this.getProxy().number(number);  this.put("number", number);return this;};
	/** and number is null */
	this.numberNull=function(){if(this.proxy)return this.getProxy().numberNull();if(this.get("numberNot")==null)this.put("numberNot", "");this.put("number", null);return this;};
	/** not .... */
	this.numberNot=function(){if(this.proxy)return this.getProxy().numberNot();this.put("numberNot", "not");return this;};
	this.numberNotNull=function(){if(this.proxy)return this.getProxy().numberNotNull();this.put("numberNot", "not");this.put("number", null);return this;};
	this.numberNot=function(number){if(this.proxy)return this.getProxy().numberNot(number);this.put("numberNot", "not");this.put("number", number);return this;};
		
	/** and number <= ? */
	this.numberMin=function(min){if(this.proxy)return this.getProxy().numberMin(min);this.put("numberMin", min);return this;};
	/** and number >= ? */
	this.numberMax=function(max){if(this.proxy)return this.getProxy().numberMax(max);this.put("numberMax", max);return this;};
		
		
	this.numberIn=function(ids){
		if(this.proxy)return this.getProxy().numberIn(ids);  this.put("numberIn", ids);return this;
	};	
		 
	
	
	/** 限制        **/
	this.pLimit=function(pLimit){if(this.proxy)return this.getProxy().pLimit(pLimit);  this.put("pLimit", pLimit);return this;};
	/** and p_limit is null */
	this.pLimitNull=function(){if(this.proxy)return this.getProxy().pLimitNull();if(this.get("pLimitNot")==null)this.put("pLimitNot", "");this.put("pLimit", null);return this;};
	/** not .... */
	this.pLimitNot=function(){if(this.proxy)return this.getProxy().pLimitNot();this.put("pLimitNot", "not");return this;};
	this.pLimitNotNull=function(){if(this.proxy)return this.getProxy().pLimitNotNull();this.put("pLimitNot", "not");this.put("pLimit", null);return this;};
	this.pLimitNot=function(pLimit){if(this.proxy)return this.getProxy().pLimitNot(pLimit);this.put("pLimitNot", "not");this.put("pLimit", pLimit);return this;};
		
	/** and p_limit <= ? */
	this.pLimitMin=function(min){if(this.proxy)return this.getProxy().pLimitMin(min);this.put("pLimitMin", min);return this;};
	/** and p_limit >= ? */
	this.pLimitMax=function(max){if(this.proxy)return this.getProxy().pLimitMax(max);this.put("pLimitMax", max);return this;};
		
		
	this.pLimitIn=function(ids){
		if(this.proxy)return this.getProxy().pLimitIn(ids);  this.put("pLimitIn", ids);return this;
	};	
		 
	
	
	/** 规格属性        **/
	this.attribute=function(attribute){if(this.proxy)return this.getProxy().attribute(attribute);  this.put("attribute", attribute);return this;};
	/** and attribute is null */
	this.attributeNull=function(){if(this.proxy)return this.getProxy().attributeNull();if(this.get("attributeNot")==null)this.put("attributeNot", "");this.put("attribute", null);return this;};
	/** not .... */
	this.attributeNot=function(){if(this.proxy)return this.getProxy().attributeNot();this.put("attributeNot", "not");return this;};
	this.attributeNotNull=function(){if(this.proxy)return this.getProxy().attributeNotNull();this.put("attributeNot", "not");this.put("attribute", null);return this;};
	this.attributeNot=function(attribute){if(this.proxy)return this.getProxy().attributeNot(attribute);this.put("attributeNot", "not");this.put("attribute", attribute);return this;};
		
		 
	
	
	/** 预留字段        **/
	this.count=function(count){if(this.proxy)return this.getProxy().count(count);  this.put("count", count);return this;};
	/** and count is null */
	this.countNull=function(){if(this.proxy)return this.getProxy().countNull();if(this.get("countNot")==null)this.put("countNot", "");this.put("count", null);return this;};
	/** not .... */
	this.countNot=function(){if(this.proxy)return this.getProxy().countNot();this.put("countNot", "not");return this;};
	this.countNotNull=function(){if(this.proxy)return this.getProxy().countNotNull();this.put("countNot", "not");this.put("count", null);return this;};
	this.countNot=function(count){if(this.proxy)return this.getProxy().countNot(count);this.put("countNot", "not");this.put("count", count);return this;};
		
	/** and count <= ? */
	this.countMin=function(min){if(this.proxy)return this.getProxy().countMin(min);this.put("countMin", min);return this;};
	/** and count >= ? */
	this.countMax=function(max){if(this.proxy)return this.getProxy().countMax(max);this.put("countMax", max);return this;};
		
		
	this.countIn=function(ids){
		if(this.proxy)return this.getProxy().countIn(ids);  this.put("countIn", ids);return this;
	};	
		 
	
	
	/** 来源描述        **/
	this.descr=function(descr){if(this.proxy)return this.getProxy().descr(descr);  this.put("descr", descr);return this;};
	/** and descr is null */
	this.descrNull=function(){if(this.proxy)return this.getProxy().descrNull();if(this.get("descrNot")==null)this.put("descrNot", "");this.put("descr", null);return this;};
	/** not .... */
	this.descrNot=function(){if(this.proxy)return this.getProxy().descrNot();this.put("descrNot", "not");return this;};
	this.descrNotNull=function(){if(this.proxy)return this.getProxy().descrNotNull();this.put("descrNot", "not");this.put("descr", null);return this;};
	this.descrNot=function(descr){if(this.proxy)return this.getProxy().descrNot(descr);this.put("descrNot", "not");this.put("descr", descr);return this;};
		
		 
	
	
	/** 有效期        **/
	this.pTermValidity=function(pTermValidity){if(this.proxy)return this.getProxy().pTermValidity(pTermValidity);  this.put("pTermValidity", pTermValidity);return this;};
	/** and p_term_validity is null */
	this.pTermValidityNull=function(){if(this.proxy)return this.getProxy().pTermValidityNull();if(this.get("pTermValidityNot")==null)this.put("pTermValidityNot", "");this.put("pTermValidity", null);return this;};
	/** not .... */
	this.pTermValidityNot=function(){if(this.proxy)return this.getProxy().pTermValidityNot();this.put("pTermValidityNot", "not");return this;};
	this.pTermValidityNotNull=function(){if(this.proxy)return this.getProxy().pTermValidityNotNull();this.put("pTermValidityNot", "not");this.put("pTermValidity", null);return this;};
	this.pTermValidityNot=function(pTermValidity){if(this.proxy)return this.getProxy().pTermValidityNot(pTermValidity);this.put("pTermValidityNot", "not");this.put("pTermValidity", pTermValidity);return this;};
		
	/** and p_term_validity >= ? */
	this.pTermValidityStart=function(start){if(this.proxy)return this.getProxy().pTermValidityStart(start);this.put("pTermValidityStart", start);return this;};			
	/** and p_term_validity <= ? */
	this.pTermValidityEnd=function(end){if(this.proxy)return this.getProxy().pTermValidityEnd(end);this.put("pTermValidityEnd", end);return this;};
		
		 
	
	
	/** 修改时间 [非空]       **/
	this.updateTime=function(updateTime){if(this.proxy)return this.getProxy().updateTime(updateTime);  this.put("updateTime", updateTime);return this;};
	/** and update_time is null */
	this.updateTimeNull=function(){if(this.proxy)return this.getProxy().updateTimeNull();if(this.get("updateTimeNot")==null)this.put("updateTimeNot", "");this.put("updateTime", null);return this;};
	/** not .... */
	this.updateTimeNot=function(){if(this.proxy)return this.getProxy().updateTimeNot();this.put("updateTimeNot", "not");return this;};
	this.updateTimeNotNull=function(){if(this.proxy)return this.getProxy().updateTimeNotNull();this.put("updateTimeNot", "not");this.put("updateTime", null);return this;};
	this.updateTimeNot=function(updateTime){if(this.proxy)return this.getProxy().updateTimeNot(updateTime);this.put("updateTimeNot", "not");this.put("updateTime", updateTime);return this;};
		
	/** and update_time >= ? */
	this.updateTimeStart=function(start){if(this.proxy)return this.getProxy().updateTimeStart(start);this.put("updateTimeStart", start);return this;};			
	/** and update_time <= ? */
	this.updateTimeEnd=function(end){if(this.proxy)return this.getProxy().updateTimeEnd(end);this.put("updateTimeEnd", end);return this;};
		
		 
	
	
	/** 添加时间 [非空]       **/
	this.addTime=function(addTime){if(this.proxy)return this.getProxy().addTime(addTime);  this.put("addTime", addTime);return this;};
	/** and add_time is null */
	this.addTimeNull=function(){if(this.proxy)return this.getProxy().addTimeNull();if(this.get("addTimeNot")==null)this.put("addTimeNot", "");this.put("addTime", null);return this;};
	/** not .... */
	this.addTimeNot=function(){if(this.proxy)return this.getProxy().addTimeNot();this.put("addTimeNot", "not");return this;};
	this.addTimeNotNull=function(){if(this.proxy)return this.getProxy().addTimeNotNull();this.put("addTimeNot", "not");this.put("addTime", null);return this;};
	this.addTimeNot=function(addTime){if(this.proxy)return this.getProxy().addTimeNot(addTime);this.put("addTimeNot", "not");this.put("addTime", addTime);return this;};
		
	/** and add_time >= ? */
	this.addTimeStart=function(start){if(this.proxy)return this.getProxy().addTimeStart(start);this.put("addTimeStart", start);return this;};			
	/** and add_time <= ? */
	this.addTimeEnd=function(end){if(this.proxy)return this.getProxy().addTimeEnd(end);this.put("addTimeEnd", end);return this;};
		
		 
	
	
	/** 状态 [非空]   1:正常 0:无效     **/
	this.status=function(status){if(this.proxy)return this.getProxy().status(status);  this.put("status", status);return this;};
	/** and status is null */
	this.statusNull=function(){if(this.proxy)return this.getProxy().statusNull();if(this.get("statusNot")==null)this.put("statusNot", "");this.put("status", null);return this;};
	/** not .... */
	this.statusNot=function(){if(this.proxy)return this.getProxy().statusNot();this.put("statusNot", "not");return this;};
	this.statusNotNull=function(){if(this.proxy)return this.getProxy().statusNotNull();this.put("statusNot", "not");this.put("status", null);return this;};
	this.statusNot=function(status){if(this.proxy)return this.getProxy().statusNot(status);this.put("statusNot", "not");this.put("status", status);return this;};
		
		
	this.statusIn=function(ids){
		if(this.proxy)return this.getProxy().statusIn(ids);  this.put("statusIn", ids);return this;
	};	
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有产品余额 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/products/product.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取产品余额分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/products/product.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取产品余额 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/products/product.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

Product.get = function(id){
	var protocol = ux.ajax("/admin/products/product.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.product;
	return null;
}

Product.where = new Product.Where(0,true);